<?php
// 3 kasım 2010
class Cache
{
    private static $instances = array();
    private function __construct(){}

    public static function factory($adapter)
    {
        if (isset(self::$instances[$adapter])) {
            return self::$instances[$adapter];
        }

        $class = 'Cache_Adapter_' . ucfirst($adapter);
        $path  = str_replace('_', DIRECTORY_SEPARATOR, $class);

        require_once (dirname(__file__) . DIRECTORY_SEPARATOR . $path . '.php');
        $obj = new $class();
        self::$instances[$adapter] = $obj;
        return $obj;
    }

} //sınıf sonu
